package com.thb.pay.api.agent;


import com.thb.pay.api.agent.fallback.AgentAccountHistoryServiceApiFallbackFactory;
import com.thb.pay.api.agent.vo.req.AgentAccountHistoryPageReq;
import com.thb.pay.api.agent.vo.req.AgentAccountHistoryReq;
import com.thb.pay.api.agent.vo.resp.AgentAccountHistoryVo;
import com.thb.pay.core.utils.PageResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 代理商-账户-流水表 前端控制器
 * </p>
 *
 * @author lucky
 * @since 2019-07-21
 */
@FeignClient(value = "pay-service", fallbackFactory = AgentAccountHistoryServiceApiFallbackFactory.class)
@RequestMapping("/agentAccountHistoryApi")
public interface AgentAccountHistoryServiceApi {


    /**
     * @param pageReq 分页参数
     * @Description 分页获取代理商账户流水信息
     * @Author lucky
     * @data 2019/7/21 22:10
     */
    @RequestMapping(value = "/findPage", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    PageResult<AgentAccountHistoryVo> findPage(@RequestBody AgentAccountHistoryPageReq pageReq);

    /**
     * @param agentAccountHistoryReq
     * @Description 统计 代理商账户流水
     * @Author lucky
     * @data 2019/7/21 22:11
     */
    @RequestMapping(value = "/count", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    int count(@RequestBody AgentAccountHistoryReq agentAccountHistoryReq);

    /**
     * @param id 代理商账户流水ID
     * @Description 获取代理商账户流水详情
     * @Author lucky
     * @data 2019/7/21 22:12
     */
    @RequestMapping(value = "/getById", method = RequestMethod.GET)
    AgentAccountHistoryVo getById(@RequestParam("id") Long id);

    /**
     * @param agentId 代理商ID
     * @param id      代理商账户流水ID
     * @Description 获取 某个代理商 对应的代理信息详情
     * @Author lucky
     * @data 2019/7/21 22:12
     */
    @RequestMapping(value = "/getByAgentIdAndId", method = RequestMethod.GET)
    AgentAccountHistoryVo getByAgentIdAndId(@RequestParam("agentId") Long agentId, @RequestParam("id") Long id);

    /**
     * @param agentId 代理商ID
     * @Description 统计代理商分润
     * <p>
     * bizType == 1 分润
     * bizType == 2 提现
     * bizType == 3 调账
     * </P>
     * @Author lucky
     * @data 2019/7/21 22:12
     */
    @RequestMapping(value = "/countAgentProfit", method = RequestMethod.GET)
    List<Map<String, Object>> countAgentProfit(@RequestParam("agentId") Long agentId);
}
